package nio;

import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class Charsets {

	public static void main(String[] args) {
		Map<String, Charset> charsetMap = Charset.availableCharsets();
		Set<String> keySet = charsetMap.keySet();

		for (Iterator<String> iter = keySet.iterator(); iter.hasNext();) {
			String cskey = iter.next();
			System.out.print(cskey);
			Charset charset = charsetMap.get(cskey);
			Iterator<String> aliasIter = charset.aliases().iterator();
			if (aliasIter.hasNext())
				System.out.print(": ");
			while (aliasIter.hasNext()) {
				System.out.print(aliasIter.next());
				if (aliasIter.hasNext())
					System.out.print(", ");
			}
			System.out.println();
		}
		
		System.out.println(System.getProperty("file.encoding"));
	}
}
